﻿/*
using System.IO;
using Facebook;
using System;
using System.Net;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Web;
namespace Sprint1.Logic
{
    public class facebook
    {
        // FB Login & Sign up Function
        public void Login()
        {
            string app_id = "618386488238601";
            string app_secret = "dfc8420e9b078b7308e681a935995352";
            string scope = "email";

            // for redirect to fb page and enter his e-mail
            if (Request["code"] == null)
            {
                Response.Redirect(string.Format(
                    "https://www.facebook.com/dialog/oauth?client_id={0}&redirect_uri={1}&scope={2}",
                    app_id, Request.Url.AbsoluteUri, scope));
            }
            else
            {

                Dictionary<string, string> tokens = new Dictionary<string, string>(); // for save access_token.
                Student student = new Student(); // my student object.
                string url = string.Format("https://graph.facebook.com/oauth/access_token?client_id={0}&redirect_uri={1}&code={2}&client_secret={3}",
                    app_id, Request.Url.AbsoluteUri, Request["code"].ToString(), app_secret);
                // URL for accessing with app_id and secret to show permissions.
                HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
                using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) // request for permission
                {
                    StreamReader reader = new StreamReader(response.GetResponseStream());
                    string vals = reader.ReadToEnd();
                    // get access_token
                    foreach (string token in vals.Split('&'))
                    {
                        tokens.Add(token.Substring(0, token.IndexOf("=")),
                            token.Substring(token.IndexOf("=") + 1, token.Length - token.IndexOf("=") - 1));
                    }
                }
                string access_token = tokens["access_token"]; // get access token into a string
                FacebookClient fb = new FacebookClient(access_token); // create a new facebookclient
                var results = (IDictionary<string, object>)fb.Get("/me"); // get all fb account info into result using dictionary
                student.Name = results["name"].ToString();
                student.Email = results["email"].ToString();
            }
        }
    }
}
*/